import { Injectable } from '@angular/core';
import { HttpClient } from "@angular/common/http";

import { map } from 'rxjs/operators';

@Injectable({
  providedIn: 'root'
})
export class MenuService {

  public menuConfigURL = "mock-data/menu.config.json";

  constructor(
    private http: HttpClient,
  ) { }
  getTopMenuList() {
    return this.http.get<any>(this.menuConfigURL).pipe(
      map(data => data["top"]),
    );
  }
  getSideMenuList(id = 'overview') {
    return this.http.get<any>(this.menuConfigURL).pipe(
      map(data => data[id]),
    );
  }

}
